package com.baway.notice.viewmodel

import androidx.lifecycle.viewModelScope
import com.baway.home.model.NoticeResult
import com.baway.notice.repo.NoticeRepo
import com.bw.lib_common.vm.BaseViewModel
import kotlinx.coroutines.launch

class NoticeViewModel: BaseViewModel<List<NoticeResult>>() {
    private val noticeRepo = NoticeRepo()

    fun getNoticeList(page: Int, size: Int){
        viewModelScope.launch {
            val result = noticeRepo.getNoticeList(page, size)
            if (result.code == 200){
                mSuccessLiveData.value = result.data
            }else{
                mErrorLiveData.value = result.message
            }
        }
    }
}